#!/usr/bin/env python
# -*- coding:UTF-8 -*-
"""
bridge.py
桥接模式代码原型
"""

from abc import ABCMeta, abstractmethod

class Product(object):
    def __init__(self): self._func = None
    def set_func(self, func): self._func = func
    def show(self): return self.__class__, self._func.show()

class ProductA(Product): pass
class ProductB(Product): pass

class Func(object):
    __metaclass__ = ABCMeta

    @abstractmethod
    def show(self): pass

class FuncA(Func):
    def show(self): return self.__class__

class FuncB(Func):
    def show(self): return self.__class__
